package com.itheima.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.domain.OrderSetting;
import com.itheima.mapper.OrderSettingMapper;
import com.itheima.service.IOrderSettingService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 订单设置表 服务实现类
 * </p>
 *
 * @author fukeke
 * @since 2022-11-11
 */
@DubboService
public class OrderSettingServiceImpl extends ServiceImpl<OrderSettingMapper, OrderSetting> implements IOrderSettingService {

    @Autowired
    private OrderSettingMapper orderSettingMapper;

    //修改指定订单设置
    public Integer update(OrderSetting orderSetting) {
//        QueryWrapper<OmsOrderSetting> qw = new QueryWrapper<>();
//        Integer commentOvertime = orderSetting.getCommentOvertime();
//        Integer flashOrderOvertime = orderSetting.getFlashOrderOvertime();
//        Integer confirmOvertime = orderSetting.getConfirmOvertime();
//        Integer normalOrderOvertime = orderSetting.getNormalOrderOvertime();
//        Integer finishOvertime = orderSetting.getFinishOvertime();
//        qw.eq(commentOvertime != null, "comment_overtime", commentOvertime);
//        qw.eq(flashOrderOvertime != null, "flash_order_overtime", flashOrderOvertime);
//        qw.eq(confirmOvertime != null, "confirm_overtime", confirmOvertime);
//        qw.eq(normalOrderOvertime != null, "normal_order_overtime", normalOrderOvertime);
//        qw.eq(finishOvertime != null, "finish_overtime", finishOvertime);
        return orderSettingMapper.updateById(orderSetting);
    }

    //获取指定订单设置
    public OrderSetting findById(Long id) {
        return orderSettingMapper.selectById(id);
    }
}
